//
//  WLMessageDetailController.m
//  WanLian
//
//  Created by muzhuang on 2018/10/19.
//  Copyright © 2018年 wanlian. All rights reserved.
//

#import "WLMessageDetailController.h"

@interface WLMessageDetailController ()

@end

@implementation WLMessageDetailController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.title = _messageInfo.title;
    
    UITextView *textView = [[UITextView alloc] initWithFrame:self.view.bounds];
    textView.editable = NO;
    [self.view addSubview:textView];
    
    textView.text = self.messageInfo.content;
    
    [self messageReaded];
}

- (void)messageReaded
{
//    WLWkSelf
    NSDictionary *params = @{@"id":@(_messageInfo.msgId)};
    [WLHttpManager WLRequestMethod:RequestTypePost urlStr:@"noticemsg/set/haslook" withParamsDic:params success:^(NSDictionary *successDict) {
        NSInteger unreadNum = [[NSUserDefaults standardUserDefaults] integerForKey:UNREAD_MSG_NUM];
        if (unreadNum-1>0) {
            [[NSUserDefaults standardUserDefaults] setInteger:unreadNum-1 forKey:UNREAD_MSG_NUM];
        }
        else
        {
            [[NSUserDefaults standardUserDefaults] removeObjectForKey:UNREAD_MSG_NUM];
        }
    } failure:^(NSString *errorMsg, NSInteger errorTag) {
        
    } error:^(NSError *error) {

    } inView:self.view];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
